package com.goktech.project.hmw.controller;

import com.goktech.project.hmw.mapper.Sj;
import com.goktech.project.hmw.service.ISjService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/sj")
public class SjController {

	@Autowired
	private ISjService sjService;
	/**
	 * 通过peojectId获取数据集合
	 * @param reqMap
	 * @return
	 */
	@PostMapping("/projectid")
	public List<Sj> listSjByProjectId(@RequestBody Map<String,String> reqMap){
		return sjService.listSjByProjectId(reqMap.get("project_id"));
	}

	/**
	 * 通过idard获取数据集合
	 * @param reqMap
	 * @return
	 */
	@PostMapping("/idcard")
	public List<Sj> listSjByIdCard (@RequestBody Map<String,String> reqMap){
		return sjService.listSjByIdCard(reqMap.get("idcard"));
	}

	/**
	 * 通过姓名获取数据集合
	 * @param reqMap
	 * @return
	 */
	@PostMapping("/name")
	public List<Sj> listSjByName(@RequestBody Map<String,String> reqMap){
		return sjService.listSjByName(reqMap.get("name"));
	}

	/**
	 * 通过年月获取数据
	 * @param reqMap
	 * @return
	 */
	@PostMapping("/year")
	public List<Sj> ListSjByYear(@RequestBody Map<String,String> reqMap){
		return sjService.ListSjByYear(reqMap.get("grant_year"));
	}
}
